package com.feihong.txgw.ui.activity.kaika;

import android.app.Activity;

import java.util.ArrayList;

/**
 * Created by Sabirjan on 2017/8/8.
 * TXGWApp.
 * 飞宏电子
 */

public class KaikaManager {

    public KaikaManager() {

    }

    private static KaikaManager mKaikaManager;
    private ArrayList<Activity> stack = new ArrayList<>();

    public static KaikaManager getmKaikaManager() {
        if (mKaikaManager == null) {
            mKaikaManager = new KaikaManager();
        }
        return mKaikaManager;
    }

    public void clearAll() {
        if (stack != null) {
            for (Activity item : stack) {
                if (item != null) {
                    item.finish();
                }
            }
            stack.clear();
            stack = new ArrayList<>();
        }
    }

    public void addStack(Activity activity) {
        if (stack == null) {
            stack = new ArrayList<>();
        }
        stack.add(activity);

    }


}
